<template>
  <div class="blog-home">
    <header class="blog-home-header">
      <h2 class="blog-home-header-title">最新文章</h2>
    </header>
    <main class="blog-home-main">
      <div class="blog-home-main-item" v-for="item in articles" :key="item">
        <h3 class="blog-home-main-item-title">{{ item.title }}</h3>
        <p class="blog-home-main-item-content">
          {{ item.content }}
        </p>
        <div class="blog-home-main-item-info">
          <div class="blog-home-main-item-info-item">
            <img class="icon" src="@/assets/images/icon-date.png" alt="日期" />
            <span>2025-01-01</span>
          </div>
          <div class="blog-home-main-item-info-item">
            <img class="icon" src="@/assets/images/icon-eye.png" alt="阅读量" />
            <span>1000</span>
          </div>
        </div>
      </div>
    </main>
  </div>
</template>

<script lang="ts" setup>
// script
import { ref } from 'vue';

const articles = ref([]);
</script>

<style lang="scss" scoped>
.blog-home {
  padding: 0 32px;

  &-header {
    width: 100%;
    height: 88px;
    line-height: 88px;
  }

  &-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: calc(100vh - 88px);
    overflow-y: auto;
    padding: 0 0 32px 0;

    &::-webkit-scrollbar {
      display: none;
    }

    &-item {
      padding: 25px;
      height: 170px;
      border-radius: 12px;
      border: 1px solid #f3f4f6;

      &-title {
        font-size: 20px;
        font-weight: 600;
        line-height: 28px;
        color: #2c2c2c;
      }

      &-content {
        display: -webkit-box;
        line-clamp: 2;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 16px;
        line-height: 24px;
        color: #666;
      }

      &-info {
        display: flex;
        align-items: center;
        gap: 12px;

        &-item {
          display: flex;
          align-items: center;
          gap: 4px;
          font-size: 14px;
          line-height: 20px;
          color: #9ca3af;
        }
      }
    }
  }
}
</style>
